Skip to main content

Users

Introduction

The Users API offers tools for managing user accounts on your platform. It includes functionality for creating, updating, deactivating, and reactivating users, as well as managing user sessions and permissions. This documentation will assist you in maintaining a robust user management system, ensuring secure and efficient access to your platform's resources.

info

Make sure you generated the api_token on your store. More info HERE

Endpoints
Create
Update
Deactivate
Reactivate
Force Logout

Create

POST /integration-api/v1/dashboard/users/

Request Body

ParameterTypeDescription
external_idstringRequired
emailstringRequired
new_passwordstringRecommended
sessions_limitinteger
assign_new_planinteger
new_plan_custom_valid_tostring
adminboolean
plan_adminboolean
only_sees_readableboolean
{
"email":"[email protected]",
"external_id":"user-id-in-your-platform",
"new_password":"Abcd1234",
"sessions_limit":null, //if you need to limit the simultaneous user sessions, here you must enter an integer no greater than 999999
"assign_new_plan": null, //if you need to assign a plan, you must enter the plan_id here
"new_plan_custom_valid_to":"", //Accepted date format: yyyy-mm-dd
"admin":false,
"plan_admin":false,
"only_sees_readable":true,
}

Response

CodeDescription
200Object Created
422Validation error, the reason of the error will be described in the response body
401Unauthenticated
{
"CODE": "success",
"data": {
"id": 923242,
"email": "[email protected]",
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"picture": "https://www.gravatar.com/avatar/5c472faa5105266a3d41aee277eb9d0c?s=160&d=mm&r=g",
"admin": false,
"plan_admin": false,
"only_sees_readable": false,
"sessions_limit": null,
"created_at": {
"timestamp": 1620931649,
"date": "2021-05-13 18:47:29",
"timezone": "UTC"
},
"updated_at": {
"timestamp": 1621256387,
"date": "2021-05-17 12:59:47",
"timezone": "UTC"
},
"deleted_at": null
}
}

Retrieve

GET /integration-api/v1/dashboard/users

Query Parameters

tip

Using query parameter you can filter by email, deactivated and admins users

ParameterTypeExample
emailstring/integration-api/v1/dashboard/users/[email protected]
deactivatedinteger/integration-api/v1/dashboard/users/?query=deactivated
adminsinteger/integration-api/v1/dashboard/users/?query=admins

Response

CodeDescription
200Success
404Object not found
401Unauthenticated
Example
{
"CODE": "success",
"data": {
"paginator": {
"current_page": 1,
"data": [
{
"id": 923242,
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"admin": false,
"plan_admin": false,
"email": "[email protected]",
"sessions_limit": 1,
"only_sees_readable": 1,
"picture": "https://www.gravatar.com/avatar/98789c9d5825d6f6c6615313ffcaf1ac?s=160&d=mm&r=g",
"created_at": "2021-05-18T13:28:53.000000Z",
"updated_at": "2021-05-18T13:28:53.000000Z",
"deleted_at": null,
"purchased_issues_with_cancelled_count": 0,
"user_plans_count": 0,
"can_be_edited": true,
"created_at_date_string": "2021-05-18",
"impersonate": "https://example.publica.la/impersonate/take/53114",
"sessions": null,
"ip_ranges": [],
"referrers": [],
"purchased_issues_with_cancelled": [],
"user_plans": []
},
{
...
}]
}
}
}

Update

PUT /integration-api/v1/dashboard/users/{user_id}

Request Body

ParameterTypeDescription
external_idstringRequired
emailstringRequired
new_passwordstringRecommended
sessions_limitinteger
assign_new_planinteger
new_plan_custom_valid_tostring
adminboolean1 or 0
plan_adminboolean1 or 0
only_sees_readablebooleanRequired 1 or 0
user_plan_name

Response

CodeDescription
204Object Updated
422Validation error, the reason of the error will be described in the response body
401Unauthenticated

Deactivate

IMPORTANT NOTE

This endpoint enables you to deactivate an user. A deactivated user can not log in through any means.

DELETE /integration-api/v1/dashboard/users/{id}

ParameterTypeExample
idinteger/integration-api/v1/dashboard/users/923242

Response

CodeDescription
200Object deleted
404Object not found
401Unauthenticated
{
"CODE": "success",
"data": []
}

Reactivate

PUT /integration-api/v1/dashboard/users/{user_id}/re-activate

ParameterTypeExample
idinteger/integration-api/v1/dashboard/users/923242/re-activate

Response

CodeDescription
200Object deleted
404Object not found
401Unauthenticated
{
"CODE": "success",
"data": 1
}

Force Logout

POST /integration-api/v1/users/{user_id}/force-logout

ParameterTypeExample
idinteger/integration-api/v1/dashboard/users/923242/force-logout
important

After logging out, the user will be redirected to the initial URL on its next interaction with the system.

The endpoint receives as user identifier the ID or the external_id. Keep in mind that in the case the external-auth-token is used then the external_id is the UUID contained in the token.